﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DotNet.Encrypt;
using DotNet.Mvc;

namespace DotNet.EduWebApi.Controllers
{
    public class EncryptController : JsonController
    {
        public ActionResult Encrypt(string s)
        {
            var es = StringEncrypt.Encrypt(s);
            return Content(es);
        }

        public ActionResult Decrypt(string s)
        {
            var result = EncryptUtil.Decrypt(s);
            if (!result.Success)
            {
                return Json(result);
            }
            return Content(result.Data);
        }
    }
}